<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times-circle"></i></button>
	<h4 class="modal-title" id="general-modal-label">{{ $text_edit_voucher }}</h4>
</div>
<div class="modal-body">
	<table class="table table-bordered">
		<tr>
			<td>{{ Form::label('voucher_owner', $text_voucher_owner) }}</td>
			<td>{{ Form::text('voucher_owner', $po_item_voucher->voucher_owner, [ 'class' => 'form-control' ]) }}</td>
			<td>{{ Form::label('voucher_code', $text_voucher_code) }}</td>
			<td>{{ Form::text('voucher_code', $po_item_voucher->voucher_code, [ 'class' => 'form-control' ]) }}</td>
		</tr>
		<tr>
			<td>{{ Form::label('product_name', $text_product_name) }}</td>
			<td>{{ Form::text('product_name', $po_item_voucher->product_name, [ 'class' => 'form-control' ]) }}</td>
			<td>{{ Form::label('supplier_name', $text_supplier_name) }}</td>
			<td>{{ Form::text('supplier_name', $po_item_voucher->supplier_name, [ 'class' => 'form-control' ]) }}</td>
		</tr>
	</table>
	<div class="form-group">
		{{ Form::label('date_issued', $text_date_issued) }}
		{{ Form::text('date_issued', ($po_item_voucher->date_issued) ? date_format(date_create($po_item_voucher->date_issued), 'm/d/Y g:i A') : date('m/d/Y g:i A'), [ 'class' => 'form-control' ]) }}
	</div>
	<div class="form-group">
		{{ Form::label('voucher_description', $text_voucher_desc) }}
		{{ Form::textarea('voucher_description', $po_item_voucher->voucher_description, ['class' => 'form-control']) }}
	</div>
	{{ Form::hidden('PURCHASE_ORDER_PRODUCT_id', $po_item_voucher->PURCHASE_ORDER_PRODUCT_id) }}
</div>
<div class="modal-footer">
	
	{{ Form::button($text_save_voucher_rec, ['class' => 'btn btn-success btn-save-vrec']) }}
	<script type="text/javascript">
	$('textarea[name="voucher_description"]').summernote({
        height: 200,
        tabsize: 2,
        toolbar: [
  		    ['style', ['bold', 'italic', 'underline', 'clear']],
  		    ['color', ['color']],
  		    ['para', ['ul', 'ol', 'paragraph']],
  		    ['height', ['height']],
  		    ['table', ['table']],
  		    ['insert', ['hello', 'helloImage']],
  		    ['insert2', ['helloDropdown']],
  		  ]
	});
	</script>
	<script type="text/javascript">
	$("input[name='date_issued']").datetimepicker();
	</script>
	<script type="text/javascript">
	$(".btn-save-vrec").click(function(){
		var data = {
			'voucher_owner':$('input[name="voucher_owner"]').val(),
			'voucher_code':$('input[name="voucher_code"]').val(),
			'product_name':$('input[name="product_name"]').val(),
			'supplier_name':$('input[name="supplier_name"]').val(),
			'date_issued':$('input[name="date_issued"]').val(),
			'voucher_description':htmlencode($('textarea[name="voucher_description"]').code()),
			'PURCHASE_ORDER_PRODUCT_id':$('input[name="PURCHASE_ORDER_PRODUCT_id"]').val()
		};
		
		$.ajax({
			url: $('base').attr('href') + '/po/updateVoucherDetails',
			type: 'POST',
			data: data,
			dataType: 'json',
			success: function(response){
				if(response.success == 1){
					$('#general-modal').modal('hide');
					alert("Voucher has been successfully saved.");
				}
			}
		});
	});
	</script>
</div>